import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

public class Player {
	protected Hashtable<String, Statistic> stats;
	private int id;
	Player() { this.stats = new Hashtable<String, Statistic>(); }

	Player( ArrayList<Statistic> mrohai ) {
		this.stats = new Hashtable<String, Statistic>();
		for ( int i = 0; i < mrohai.size(); ++i )
			this.stats.put(mrohai.get(i).name, mrohai.get(i));
	}
	public void addStat( String name, Statistic n ) {
		this.stats.put(name,n);
	}
	public Statistic getStat( String name ) throws WTFException {
		if ( this.stats.containsKey( name ) ) {
			return this.stats.get(name);
		} else {
			throw new WTFException();
		}
	}
	
	public boolean hasSameID( Player p ) {
		return ( this.getID() == p.getID() );
	}
	
	public String toString() {
		String s = "";
		Enumeration<Statistic> statz = this.stats.elements();
		while ( statz.hasMoreElements() ) {
			Statistic woo_tang = statz.nextElement();
			s += woo_tang.name + ":" + woo_tang.value + "\r\n";
		}
		return s;
	}

	public void setID(int c) {
		this.id = c;
	}
	public int getID() { return this.id; }
}
